xml.user do
	@totalbet = 0
    @totalwin = 0
    xml.login(@user.login)
    xml.nombre(@user.name)
    xml.correo(@user.email)
    xml.apuestas do
    	for o in Bet.find_all_by_user_idf(@user.id)
    		@eventparticipant=Eventparticipant.find_by_id(o.eventparticipant_idf)
            @participant=Participant.find_by_id(@eventparticipant.participant_idf)
            @event=Event.find_by_id(@eventparticipant.event_idf)
            @totalbet=@totalbet+o.ammount
            xml.evento do
            	xml.nombre_evento (@event.name)
            	xml.favorito (@participant.name)
    			xml.monto (o.ammount)
    			for participants in Eventparticipant.find_all_by_event_idf(@event.id)
    				 if participants.id != @eventparticipant.id
    				 	if participants.score.nil? && @eventparticipant.score.nil? 
    				 		 xml.status ("N/A")
	                    else
    				 		if participants.score > @eventparticipant.score
        		   	        	xml.status("No Ganador")
        		   	        else
        		   	            @totalwin=@totalwin+o.ammount*@eventparticipant.proportion
        		   	        	xml.status("Ganador")
        		   	        	xml.ganancia (o.ammount*@eventparticipant.proportion)
				 	    	end
			            end
				     end
            	end
    		end
    	end
    end
    xml.total_apostado (@totalbet)
    xml.total_ganado   (@totalwin)
    xml.ganancia_casa  (@totalbet-@totalwin)
end





